home *** CD-ROM | disk | FTP | other *** search
/ Whiteline: delta / whiteline CD Series - delta.iso / vision / grafics / programm / scrdump / source / sdump.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-25  |  14.6 KB  |  671 lines

  1. #include <tos.h>
  2. #include <gem.h>
  3. #include <vdi.h>
  4. #include <string.h>
  5. #include <stdlib.h>
  6.  
  7. #include "sdump.h"
  8.  
  9. #ifdef GEMDUMP                            /* anpassung für GEMDUMP */
  10.  
  11. #    include "gemdump.rsh"                /* resourcen */
  12. #    include "gemdump.h"
  13.  
  14.     extern XINST inst;                    /* definiert in gd_start.s */
  15.     extern int ev_time;
  16.     extern int althelp;
  17.     extern long ah_time;
  18.     int scr_nr;
  19.      int evnts=MU_MESAG;
  20.  
  21.     int do_store_img(char *name,MFDB *buffer,int wid,int hght,COLOR *col,int xflag,int pix_wid,int pix_hght);
  22.     void make_name(char *name);
  23.     long do_init_vbl(void),do_exit_vbl(void);
  24.  
  25. #    define init_vbl()        Supexec(do_init_vbl)
  26. #    define exit_vbl()        Supexec(do_exit_vbl)
  27.  
  28. #    define _store_img        do_store_img
  29. #    define _make_name        make_name
  30. #    define MENUE_ENTRY        "  GEM-Dump"
  31. #    define PARAM_SAVE        "C:\\GEMDUMP.ACC"
  32. #    define PARAM_EXT        "*.ACC"
  33. #    define PAR_OFF            32
  34.  
  35. #else                                    /* anpassung für SCRDUMP */
  36.  
  37. #    include "scrdump.rsh"                /* resourcen */
  38. #    include "scrdump.h"
  39.  
  40. #    define inst                dump->inst
  41. #    define scr_nr            dump->nr
  42. #    define _store_img        dump->store_img
  43. #    define _make_name        dump->make_name
  44. #    define MENUE_ENTRY        "  ScreenDump"
  45. #    define PARAM_SAVE        "C:\\AUTO\\XALTHELP.PRG"
  46. #    define PARAM_EXT        "*.PRG"
  47. #    define PAR_OFF            30
  48. #endif
  49.  
  50. OBJECT *dialog;                            /* globale variable */
  51. int handle,dummy;
  52. int planes,screen_w,screen_h;
  53. int pix_wid,pix_hght;
  54.  
  55. /*
  56.     cookie-routine
  57.         get_cookie liefert zeiger zu cookie mit id 'cookie' oder 0l falls nicht gefunden
  58. */
  59. typedef struct
  60. {
  61.     long    id,
  62.             *ptr;
  63. } COOKJAR;
  64.  
  65. static long _get_cookjar(void)
  66. {
  67.     return *(long*)0x05a0l;
  68. }
  69.  
  70. long *get_cookie(long cookie)
  71. {
  72. COOKJAR    *cookiejar;
  73. int    i = 0;
  74.  
  75.     cookiejar=(COOKJAR*)Supexec(_get_cookjar);
  76.  
  77.     if ( cookiejar ) {
  78.         while ( cookiejar[i].id ) {
  79.             if ( cookiejar[i].id==cookie )
  80.                 return cookiejar[i].ptr;
  81.             i++;
  82.         }
  83.     }
  84.     return 0l;
  85. }
  86.  
  87. /*
  88.     clipping für fenster
  89. */
  90. #define min(a,b)    ((a)<(b))?(a):(b)
  91. #define max(a,b)    ((a)>(b))?(a):(b)
  92.  
  93. int check_recs(int x,int y,int dx,int dy,int *x1,int *y1,int *dx1,int *dy1)
  94. {        /* 'clippt' rechteck in x1,y1,dx1,dy1 mit rechteck in x,y,dx,dy */
  95.         /* rückgabe: TRUE falls rechteck übrigbleibt, sonst FALSE */
  96. int hx1,hy1,hx2,hy2;
  97.  
  98.     hx2=min(x+dx,*x1+*dx1);
  99.     hy2=min(y+dy,*y1+*dy1);
  100.     hx1=max(x,*x1);
  101.     hy1=max(y,*y1);
  102.     *x1=hx1; *y1=hy1;
  103.     *dx1=hx2-hx1; *dy1=hy2-hy1;
  104.     return (hx2>hx1)&&(hy2>hy1);
  105. }
  106.  
  107. /*
  108.     erzeuge puffer mit größe dx/dy in MFDB help
  109.     gebe länge zurück falls erfolgreich
  110.     sonst 0l
  111. */
  112. long set_fdb(int dx,int dy,MFDB *help)
  113. {
  114. long len;
  115.  
  116.     help->fd_w=dx;
  117.     help->fd_h=dy; 
  118.     help->fd_wdwidth=help->fd_w/16;
  119.     if ( dx&15 )
  120.         help->fd_wdwidth++;
  121.     help->fd_nplanes=planes;
  122.     help->fd_stand=0;
  123.     help->fd_r1=help->fd_r2=help->fd_r3=0;
  124.  
  125.     len=(long)help->fd_wdwidth*2l*(long)help->fd_h*(long)planes;
  126.     help->fd_addr=Malloc(len);
  127.     if ( help->fd_addr )
  128.         return len;
  129.     return 0;
  130. }
  131.  
  132. /*
  133.     draw_objc
  134.     undraw_objc
  135.         zeichne dialog mit pufferung des hintergrundes (falls möglich)
  136. */
  137. int draw_objc(OBJECT *objc_addr,int *x,int *y,int *dx,int *dy,MFDB *buffer)
  138. {
  139. int xy[8];
  140. int ret;
  141. MFDB screen;
  142.  
  143.     form_center(objc_addr, x,y,dx,dy);
  144.     buffer->fd_addr=0L;
  145.     screen.fd_addr=0L;
  146.  
  147.     if ( set_fdb(*dx+1,*dy+1,buffer) ) {
  148.         check_recs(0,0,screen_w,screen_h,x,y,dx,dy);
  149.         xy[0]=*x; xy[1]=*y; xy[2]=*x+*dx; xy[3]=*y+*dy;
  150.         xy[4]=0; xy[5]=0; xy[6]=*dx; xy[7]=*dy;
  151.         v_hide_c(handle);
  152.         vro_cpyfm(handle,3,xy,&screen,buffer);
  153.         v_show_c(handle,1);
  154.         ret=1;
  155.     }
  156.     if ( buffer->fd_addr==0L ) {
  157.         form_dial(FMD_START, *x,*y,*dx,*dy, *x,*y,*dx,*dy);
  158.         ret=0;
  159.     }
  160.     objc_draw(objc_addr, 0,5, *x,*y,*dx,*dy);
  161.     return(ret);
  162. }
  163.  
  164. void undraw_objc(int x,int y,int dx,int dy,MFDB *buffer,int flag)
  165. {
  166. int xy[8];
  167. MFDB screen;
  168.  
  169.     if ( flag ) {
  170.         screen.fd_addr=0L;
  171.         xy[0]=0; xy[1]=0; xy[2]=dx; xy[3]=dy;
  172.         xy[4]=x; xy[5]=y; xy[6]=x+dx; xy[7]=y+dy;
  173.         v_hide_c(handle);
  174.         vro_cpyfm(handle,3,xy,buffer,&screen);
  175.         v_show_c(handle,1);
  176.         Mfree(buffer->fd_addr);
  177.     }
  178.     else {
  179.         form_dial(FMD_FINISH, x,y,dx,dy, x,y,dx,dy);
  180.     }
  181. }
  182.  
  183. /*
  184.     initialisiere vdi
  185. */
  186. void init_vdi(void)
  187. {
  188. int i;
  189. int work_in[12],work_out[58];
  190.  
  191.      handle=graf_handle(&dummy,&dummy,&dummy,&dummy);
  192.      for ( i=0; i<10; i++ )
  193.          work_in[i]=1;
  194.      work_in[10]=2;
  195.  
  196.      v_opnvwk(work_in,&handle,work_out);
  197.  
  198.     screen_w=work_out[0]+1;
  199.     screen_h=work_out[1]+1;
  200.  
  201.     pix_wid=work_out[3];        /* should be used in save-img */
  202.     pix_hght=work_out[4];        /* not yet implemented */
  203.  
  204.     vq_extnd(handle,1,work_out);
  205.     planes=work_out[4];
  206. }
  207.  
  208. #ifdef GEMDUMP                            /* spezielle routinen für GEMDUMP */
  209.  
  210. /*
  211.     lese 200Hz-Zähler aus
  212. */
  213. static long _gettimer(void)
  214. {
  215.     return *(long*)0x4BA;
  216. }
  217. long gettimer(void)
  218. {
  219.     return Supexec(_gettimer);
  220. }
  221.  
  222. /*
  223.     ermittle konvertierungstabelle für farben
  224. */
  225. void get_conv_tab(char *conv_tab)
  226. {
  227. int i,j;
  228. unsigned int c;
  229. int set,col;
  230. int ger_buf[8],std_buf[8];
  231. int xy[]={0,0,0,0,0,0,0,0};
  232. MFDB screen={0,0,0,0,0,0,0,0,0},
  233.      ger=    {0,1,1,1,0,0,0,0,0},
  234.      std=    {0,1,1,1,1,0,0,0,0};
  235.  
  236.     vswr_mode(handle,MD_REPLACE);
  237.     vsm_type(handle,1);
  238.     vsm_height(handle,1);
  239.     wind_update(BEG_UPDATE);
  240.  
  241.     v_get_pixel(handle,0,0,&set,&col);
  242.  
  243.     ger.fd_nplanes=std.fd_nplanes=planes;
  244.     ger.fd_addr=ger_buf;
  245.     std.fd_addr=std_buf;
  246.  
  247.     for ( i=0; i<(1<<planes); i++ ) {
  248.         vsm_color(handle,i);
  249.         v_pmarker(handle,1,xy);
  250.         vro_cpyfm(handle,S_ONLY,xy,&screen,&ger);
  251.         vr_trnfm(handle,&ger,&std);
  252.         conv_tab[i]=0;
  253.         for ( j=0; j<planes; j++ ) {
  254.             c=std_buf[j];
  255.             c>>=15;
  256.             c<<=j;
  257.             conv_tab[i]|=(char)c;
  258.         }
  259.     }
  260.  
  261.     if ( set )
  262.         vsm_color(handle,col);
  263.     else
  264.         vsm_color(handle,WHITE);
  265.  
  266.     v_pmarker(handle,1,xy);
  267.     wind_update(END_UPDATE);
  268. }
  269.  
  270. /*
  271.     lese farben ein
  272. */
  273. void get_colors(COLOR *col)
  274. {
  275. char conv_tab[256];
  276. int i;
  277.  
  278.     get_conv_tab(conv_tab);
  279.     for ( i=0; i<(1<<planes); i++ )
  280.         vq_color(handle,i,0,(int*)&col[conv_tab[i]]);
  281. }
  282.  
  283. /*
  284.     speichere den ganzen bildschirm (gem-konform)
  285. */
  286. int gem_screen(void)
  287. {
  288. MFDB std,buffer,screen;
  289. long len;
  290. COLOR colors[256];
  291. char name[64];
  292. int xy[8];
  293. int err;
  294.  
  295.     _make_name(name);
  296.     err=-39;                            /* speicherfehler */
  297.                                         /* (wird überschrieben, wenn er nicht eintritt */
  298.  
  299.                                         /* puffer für screen anlegen */
  300.     if ( (len=set_fdb(screen_w,screen_h,&buffer))!=0l ) {
  301.         memset(buffer.fd_addr,0,len);
  302.         screen.fd_addr=0l;
  303.         xy[0]=xy[1]=xy[4]=xy[5]=0;
  304.         xy[2]=xy[6]=screen_w-1;
  305.         xy[3]=xy[7]=screen_h-1;
  306.                                         /* kopiere screen */
  307.         vro_cpyfm(handle,3,xy,&screen,&buffer);
  308.                                         /* zweiter puffer zum konvertieren */
  309.                                         /* (vr_trnfm geht nicht mit screen als quelle) */
  310.         if ( set_fdb(screen_w,screen_h,&std)!=0l ) {
  311.             std.fd_stand=1;
  312.                                         /* konvertieren */
  313.             vr_trnfm(handle,&buffer,&std);
  314.             if ( inst.ximg&2 || (planes>1 && inst.ximg&1) )
  315.                 get_colors(colors);
  316.                                         /* und speichern */
  317.             err=_store_img(name,&std,screen_w,screen_h,colors,inst.ximg,pix_wid,pix_hght);
  318.             Mfree(std.fd_addr);
  319.         }
  320.         Mfree(buffer.fd_addr);
  321.     }
  322.     return err;
  323. }
  324. #endif
  325.  
  326. /*
  327.     rufe dateiselector auf
  328. */
  329. int fsel(char *path,char *sel,int *button,char *label)
  330. {
  331. int h;
  332.  
  333.     if ( *path==0 ) {
  334.         *path=Dgetdrv()+'A';
  335.         strcpy(path+1,":\\*.*");
  336.     }
  337.  
  338.     if ( _GemParBlk.global[0]>=0x130 )
  339.         h=fsel_exinput(path,sel,button,label);
  340.     else
  341.         h=fsel_input(path,sel,button);
  342.  
  343.     if ( h==0 )        /* fehler -> abbruch */
  344.         *button=0;
  345.  
  346.     return h;
  347. }
  348.  
  349. /*
  350.     hole dateinamen via fileselector
  351. */
  352. int get_name(char *name,char *ext,char *label)
  353. {
  354. char path[64],file[32],*h;
  355. int button;
  356.  
  357.     strcpy(path,name);
  358.     h=strrchr(path,'\\');
  359.     if ( h ) {
  360.         h++;
  361.         strcpy(file,h);
  362.         *h=0;
  363.         strcat(path,ext);
  364.     }
  365.     else
  366.         *file=0;
  367.  
  368.     fsel(path,file,&button,label);
  369.  
  370.     if ( button ) {
  371.         strcpy(name,path);
  372.         h=strrchr(name,'\\');
  373.         if ( h ) 
  374.             h++;
  375.         else
  376.             h=name;
  377.         strcpy(h,file);
  378.         return 1;
  379.     }
  380.     return 0;
  381. }
  382.  
  383. /*
  384.     haupt-routine nach acc/prg aufruf
  385. */
  386. void do_work(void)
  387. {
  388. int ret,err;
  389. int x,y,w,h,flag;
  390. MFDB buffer,screen;
  391. char name[64];
  392. #ifndef GEMDUMP
  393.     SCREEN_DUMP *dump;                    /* zeiger auf cookie */
  394. #endif
  395.  
  396.     init_vdi();                            /* init vdi */
  397.                                         /* setzt screen_w,screen_h,planes */
  398.       screen.fd_addr=0l;
  399.  
  400. #ifndef GEMDUMP
  401.                                         /* cookie suchen */
  402.     dump=(SCREEN_DUMP*)get_cookie('SDMP');
  403.                                         /* kein keks da, falscher keks? */
  404.     if ( !dump || dump->magic!='TMMW' ) {
  405.         form_alert(1,"[3][ | Cookie nicht gefunden! | ][Abbruch]");
  406.         return;                            /* und tschüss */
  407.     }
  408. #endif
  409.                                         /* dialog voreinstellen */
  410.     strcpy(objc_tedstr(dialog,PATH),inst.file);
  411.     if ( inst.ximg&1 )
  412.         objc_select(dialog,XIMG);
  413.     else
  414.         objc_unselect(dialog,XIMG);
  415.     if ( inst.ximg&2 )
  416.         objc_select(dialog,XIMG2);
  417.     else
  418.         objc_unselect(dialog,XIMG2);
  419.     objc_unselect(dialog,RESET);
  420. #ifdef GEMDUMP
  421.     if ( inst.althelp )
  422.         objc_select(dialog,ALTHELP);
  423.     else
  424.         objc_unselect(dialog,ALTHELP);
  425. #endif
  426.  
  427.     wind_update(BEG_UPDATE);
  428.                                         /* zeichne dialog */
  429.     flag=draw_objc(dialog,&x,&y,&w,&h,&buffer);
  430.     do {                                /* bearbeite dialog */
  431.         ret=form_do(dialog,0)&0x7FFF;
  432.         if ( ret==SELECT ) {            /* namen via fsel eingeben */
  433.           char *c,path[160];
  434.  
  435.             objc_unselect(dialog,SELECT);
  436.             strcpy(path,objc_tedstr(dialog,PATH));
  437.             if ( get_name(path,"*.IMG","Pfad für ScreenDump einstellen") ) {
  438.                 c=strrchr(path,'\\');
  439.                 if ( !c )
  440.                     c=path;
  441.                 if ( !strcmp(c,"\\*.IMG") ) {
  442.                     *(c+1)=0;
  443.                     strcat(path,"SCR");
  444.                 }
  445.                 else {
  446.                     c=strrchr(path,'.');
  447.                     if ( c )
  448.                         *c=0;
  449.                 }
  450.             }
  451.             strncpy(objc_tedstr(dialog,PATH),path,30);
  452.             objc_draw(dialog,0,10,x,y,w,h);
  453.         }
  454.     } while ( ret==SELECT );
  455.     objc_unselect(dialog,ret);
  456.     undraw_objc(x,y,w,h,&buffer,flag);
  457.     if ( !flag ) {                        /* hintergrund war nicht gesichert */
  458.         wind_update(END_UPDATE);        /* -> gebe aes zeit zum restaurieren */
  459.         evnt_timer(250,0);                /*        des hintergrundes */
  460.         wind_update(BEG_UPDATE);
  461.     }
  462.  
  463.     if ( ret!=CANCEL ) {                /* daten einlesen */
  464.         strcpy(inst.file,objc_tedstr(dialog,PATH));
  465.         if ( objc_selected(dialog,XIMG) ) {
  466.             inst.ximg|=1;
  467.             if ( objc_selected(dialog,XIMG2) )
  468.                 inst.ximg|=2;
  469.             else
  470.                 inst.ximg&=~2;
  471.         }
  472.         else
  473.             inst.ximg&=~3;
  474.  
  475.         if ( objc_selected(dialog,RESET) )
  476.             scr_nr=0;
  477.  
  478. #ifdef GEMDUMP                            /* zus. opt von GEMDUMP */
  479.         if ( inst.althelp && !objc_selected(dialog,ALTHELP) ) {
  480.             inst.althelp=0;
  481.             evnts&=~MU_TIMER;
  482.             exit_vbl();
  483.         }
  484.         else if ( !inst.althelp && objc_selected(dialog,ALTHELP) ) {
  485.             if ( init_vbl() ) {
  486.                 inst.althelp=1;            /* nur wenn init_vbl erfolgreich */
  487.                 evnts|=MU_TIMER;
  488.             }
  489.         }
  490. #endif
  491.     }
  492.  
  493.     err=0;
  494.  
  495.     if ( ret==SAVE ) {                    /* speichern */
  496.       char name[64];
  497.       int f_id;
  498.       long id;
  499.         strcpy(name,PARAM_SAVE);
  500.         if ( get_name(name,PARAM_EXT,"Parameter speichern") ) {
  501.             f_id=Fopen(name,FO_RW);
  502.             if ( f_id<0 )
  503.                 form_alert(1,"[1][ Fehler beim Dateizugriff! ][ oh ]");
  504.             else {
  505.                 Fseek(PAR_OFF,f_id,0);
  506.                 Fread(f_id,4,&id);
  507.                 if ( id=='TMMW' ) {
  508.                     Fwrite(f_id,sizeof(inst),&inst);
  509.                 }
  510.                 Fclose(f_id);
  511.             }
  512.         }
  513.     }
  514.                                         /* fenster oder rahmen speichern */
  515.     else if ( ret==WINDOW || ret==DRAG ) {
  516.       long len;
  517.       int mx,my,mb;
  518.       int x,y,w,h,xy[8];
  519.  
  520.         wind_update(BEG_MCTRL);
  521.  
  522.                                         /* ermittle koordinaten */
  523.         if ( ret==WINDOW ) {                /* fenster */
  524.           int wi;
  525.             graf_mouse(POINT_HAND,0l);
  526.             evnt_button(2+3+256,3,0,&mx,&my,&mb,&dummy);
  527.             if ( mb==1 ) {
  528.                 wi=wind_find(mx,my);
  529.                 wind_get(wi,WF_WORKXYWH,&x,&y,&w,&h);    /* fenster OHNE rand */
  530.                         /* falls fensterrand angeklickt -> fenster MIT rand */
  531.                 if ( mx<x || mx>x+w || my<y || my>y+h )    
  532.                     wind_get(wi,WF_CURRXYWH,&x,&y,&w,&h);
  533.             }
  534.         }
  535.         else {                                /* rahmen */
  536.             graf_mouse(THIN_CROSS,0l);
  537.             evnt_button(2+3+256,3,0,&x,&y,&mb,&dummy);
  538.             if ( mb==1 ) {
  539.                 graf_rubberbox(x,y,-screen_w,-screen_h,&w,&h);
  540.                 if ( w<0 )
  541.                     { x+=w; w=-w; }
  542.                 if ( h<0 )
  543.                     { y+=h; h=-h; }
  544.             }
  545.         }
  546.         graf_mouse(ARROW,0l);
  547.         wind_update(END_MCTRL);
  548.  
  549.                                             /* speichern wenn links-klick */
  550.         if ( mb==1 ) {
  551.             err=-39;                        /* speicherfehler */
  552.                                             /* (wird überschrieben, wenn er nicht eintritt */
  553.             check_recs(0,0,screen_w,screen_h,&x,&y,&w,&h);
  554.             if ( (len=set_fdb(w,h,&buffer))!=0l ) {
  555.                 memset(buffer.fd_addr,0,len);
  556.                 xy[0]=x; xy[1]=y; xy[2]=x+w-1; xy[3]=y+h-1;
  557.                 xy[4]=0; xy[5]=0; xy[6]=w-1; xy[7]=h-1;
  558.                 screen.fd_addr=0;
  559.                 v_hide_c(handle);
  560.                 vro_cpyfm(handle,3,xy,&screen,&buffer);
  561.                 v_show_c(handle,1);
  562.                 _make_name(name);
  563. #ifdef GEMDUMP                                 /* für GEMDUMP: transformiere nach std */
  564.                 { MFDB std;
  565.                   COLOR colors[256];
  566.                     if ( (len=set_fdb(w,h,&std))!=0l ) {
  567.                         std.fd_stand=1;
  568.                         vr_trnfm(handle,&buffer,&std);
  569.                         if ( inst.ximg )
  570.                             get_colors(colors);
  571.                         err=_store_img(name,&std,w,h,colors,inst.ximg,pix_wid,pix_hght);
  572.                         Mfree(std.fd_addr);
  573.                     }
  574.                     Mfree(buffer.fd_addr);
  575.                 }
  576. #else
  577.                 err=_store_img(name,&buffer,w,h,0l,inst.ximg,pix_wid,pix_hght);
  578.                 Mfree(buffer.fd_addr);
  579. #endif
  580.             }
  581.         }
  582.     }
  583.     else if ( ret==SCREEN ) {            /* ganzer bildschirm */
  584. #ifdef GEMDUMP
  585.         err=gem_screen();                        /* gem konform */
  586. #else
  587.         _make_name(name);                    /* xbios/vdi-esc/line-a-vars */
  588.         err=_store_img(name,&screen,0,0,0l,inst.ximg,pix_wid,pix_hght);
  589. #endif
  590.     }
  591.  
  592.     if ( err<0 ) {                        /* fehler ausgeben */
  593.         if ( err==-1000 )
  594.             form_alert(1,"[3][ Schreibfehler! | Platte voll?! | ][Abbruch]");
  595.         else
  596.             form_error(-err-31);
  597.     }
  598.  
  599.     wind_update(END_UPDATE);
  600.     v_clsvwk(handle);
  601. }
  602.  
  603. /*
  604.     acc-schleife
  605. */    
  606. int main(void)
  607. {
  608. int gl_apid,acc_id;
  609. int message[8];
  610. OBJECT *ob;
  611. #ifdef GEMDUMP
  612. int evnt;
  613. #endif
  614.  
  615.         /* anmelden beim aes */
  616.     gl_apid=appl_init();
  617.  
  618.         /* dialog initialisieren */
  619.     dialog=rs_object;
  620.     ob=dialog;
  621.     do {
  622.         rsrc_obfix(ob,0);
  623.     } while ( !(objc_flags(ob++,0)&LASTOB) );
  624.  
  625.  
  626.     /*
  627.         ACC
  628.     */
  629.     if ( !_app ) {
  630.         acc_id=menu_register(gl_apid,MENUE_ENTRY);
  631.                                         /* anmelden */
  632.  
  633. #ifdef GEMDUMP
  634.         if ( inst.althelp ) {            /* alt/help-abfrage einschalten */
  635.             init_vbl();
  636.             evnts|=MU_TIMER;
  637.         }
  638. #endif
  639.  
  640.         while ( 1 ) {                /* acc-schleife */
  641. #ifdef GEMDUMP                                 /* für GEMDUMP */
  642.             evnt=evnt_multi(evnts, 0,0,0, 0,0,0,0,0, 0,0,0,0,0,
  643.                      message, ev_time,0, &dummy, &dummy,&dummy,&dummy,&dummy,&dummy);
  644.  
  645.                                         /* timer-evnt, althelp flag ein, zeit passt noch */
  646.             if ( evnt&MU_TIMER && althelp && gettimer()-ah_time<200 ) {                    
  647.                 init_vdi();
  648.                 gem_screen();
  649.                 v_clsvwk(handle);
  650.                 althelp=0;
  651.             }
  652.                                         /* acc-aufruf */
  653.             else if ( evnt&MU_MESAG && message[0]==AC_OPEN && message[4]==acc_id ) {
  654.                 do_work();
  655.             }
  656. #else                                        /* für SCRDUMP (kein TIMER_EVNT) */
  657.             evnt_mesag(message);
  658.             if ( message[0]==AC_OPEN && message[4]==acc_id ) {
  659.                 do_work();
  660.             }
  661. #endif
  662.         }
  663.     }
  664.     else {            /* programm */
  665.         graf_mouse(ARROW,0l);
  666.         do_work();
  667.     }
  668.     appl_exit();
  669.     return 0;
  670. }
  671.